import { useReducer } from 'react';
import './App.css';
import reducer from "./components/useReducer/reducer"
import MyUseReducer from './components/useReducer/MyUseReducer';
function App() {
  const [state, dispatch] = useReducer(reducer, { count: 0 })
  return (
    <div className="App">
      <h1>App 组件：</h1>
      <p>count： {state.count}</p>
      <button type='button' onClick={() => {
        dispatch({ type: 'increment', payload: 10 })
      }}>+</button>
      <button type='button' onClick={() => {
        dispatch({ type: 'decrement', payload: 10 })
      }}>-</button>
      <hr />
      <MyUseReducer />
    </div>
  );
}

export default App;
